package com.ihunanren.weixin.module.screen.school;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.ihunanren.webx.SessionKeeper;
import com.ihunanren.webx.UserTrackInfo;

public class LoginOut {
	@Autowired
	private HttpServletRequest request;

	public void execute(Navigator nav, Context context) {
		UserTrackInfo trackInfo = new UserTrackInfo(request);
		
		long id = trackInfo.getUserDefinedId();
		request.getSession().removeAttribute(SessionKeeper.LOGIN_USER);
		request.getSession().removeAttribute(SessionKeeper.LOGIN_USER_DEFINEDID);
		
		if(trackInfo.isLogin()){
			nav.redirectTo("weixinModule").withTarget("/school/school_course.htm").withParameter("id", id+"");
		}else{
			nav.redirectTo("weixinModule").withTarget("/school/school_course.htm");
		}
		
	}
}
